/**
 * 
 */
package com.googlecode.dynargs.model.constraints.validation;

import java.util.Arrays;

/**
 * @author Federico De Faveri defaveri@gmail.com
 *
 */
public class Pattern extends ValidationConstraint {

	protected String regexp;
	protected String[] flags;
	
	public Pattern(String message, String regexp, String[] flags) {
		super(javax.validation.constraints.Pattern.class, ValidationConstraintType.PATTERN, message);
		this.regexp = regexp;
		this.flags = flags;
	}

	/**
	 * @return the regexp
	 */
	public String getRegexp() {
		return regexp;
	}

	/**
	 * @return the flags
	 */
	public String[] getFlags() {
		return flags;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Pattern [regexp=");
		builder.append(regexp);
		builder.append(", flags=");
		builder.append(Arrays.toString(flags));
		builder.append(", message=");
		builder.append(message);
		builder.append("]");
		return builder.toString();
	}
}
